package com.weishenai.customerassistant.controller.weChat;

import com.weishenai.customerassistant.common.Result;
import com.weishenai.customerassistant.service.PublishingTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "小程序 任务")
@RestController
@RequestMapping("/wechat/publishingTask")
public class PublishingTaskWechatController {
    @Autowired
    private PublishingTaskService publishingTaskService;


    @ApiOperation("根据微信id查询任务信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wechatId", value = "微信id"),
            @ApiImplicitParam(name = "pageNum", value = "当前页"),
            @ApiImplicitParam(name = "pageSize", value = "页大小"),
            @ApiImplicitParam(name = "state", value = "状态")
    })
    @GetMapping("/getByWeiXinId/{wechatId}/{pageNum}/{pageSize}/{state}")
    public Object getByWechatId(@PathVariable(name = "wechatId") String wechatId,
                                @PathVariable(name = "pageNum") Integer pageNum,
                                @PathVariable(name = "pageSize") Integer pageSize,
                                @PathVariable(name = "state") String state) {
        return Result.success(publishingTaskService.selectByWechatId(wechatId, pageNum, pageSize, state));
    }
}
